<!DOCTYPE html>
<html>
<head>
<!--{if $isGbk}-->
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<!--{else}-->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!--{/if}-->
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0 , maximum-scale=1.0, user-scalable=0">
<title>{$jyConfig['plugin_name']}</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link href="source/plugin/tom_love/images/style.css?v={$cssJsVersion}" rel="stylesheet" type="text/css">
<script src="source/plugin/tom_love/images/jquery-1.8.3.min.js" type="text/javascript"></script>
<script type="text/javascript">
    var commonjspath = 'source/plugin/tom_love/images';
</script>
<script src="source/plugin/tom_love/images/common.js?v={$cssJsVersion}" type="text/javascript"></script>
<base target="_self">
</head>
<body>
<header class="header_style2 clearfix">
	<a href="plugin.php?id=tom_love&mod=my"></a>
	<h1>{lang tom_love:avatar_title}</h1>
</header>
<section class="avatar_box clearfix">
	<div class="avatar_main_show clearfix">
    	<figure id="avatar">   
        <img src="{$userAvatarPic}"/>
        </figure>
    </div>
	<div class="avatar_main_box clearfix">
    	<div class="avatar_main_box_file"><input type="file" name="Filedata" id="filedata" style="width:170px;"></div>
    </div>
    <div class="avatar_main_box_msg"><p>{lang tom_love:pic_upload_error1}{$jyConfig['max_upload_size']}kb{lang tom_love:pic_upload_error2}</p></div>
</section>
<script src="source/plugin/tom_love/images/ajaxfileupload.js" type="text/javascript"></script>
<script src="source/plugin/tom_love/images/buildfileupload.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).on('change', '#filedata', function() {
    loading('{lang tom_love:upload_doing}');
    uploadsuccess = function(data) {
        if(data == '') {
            loading(false);
            tusi('{lang tom_love:upload_error}');
        }
        var dataarr = data.split('|');
        dataarr[0] = $.trim(dataarr[0]);
        if(dataarr[0] == 'OK') {
            loading(false);
            $("#avatar").html('<img src="'+dataarr[1]+'">');
            tusi('{lang tom_love:upload_success}');
            setTimeout(function(){window.location.href='{$backUrl}';},1888);
        }else if(dataarr[0] == 'SIZE'){
            loading(false);
            tusi('{lang tom_love:upload_size_error}');
        } else {
            loading(false);
            tusi('{lang tom_love:upload_error}');
        }
    };
    <!--{if $jyConfig['open_llq_yasu'] == 1}-->
    $.buildfileupload({
        uploadurl:'{$uploadUrl}',
        files:this.files,
        uploadformdata:{uid:"1"},
        uploadinputname:'Filedata',
        maxfilesize:"2000",
        success:uploadsuccess,
        error:function() {
            loading(false);
            tusi('{lang tom_love:upload_error}');
        }
    });
    <!--{else}-->
    $.ajaxfileupload({
        url:'{$uploadUrl}',
        data:{uid:"1"},
        dataType:'text',
        fileElementId:'filedata',
        success:uploadsuccess,
        error: function() {
            loading(false);
            tusi('{lang tom_love:upload_error}');
        }
    });
    <!--{/if}-->

});
    
function showUploadMsg(){
	$('body').append('<div id="upload_msg_box" onclick="hideUploadMsg();" style="position:fixed;left:0px;top:0px;width:100%;height:100%;background-color: rgba(0,0,0,0.5);text-align:right;" ontouchmove="return true;" ><img src="source/plugin/tom_love/images/upload_msg.png" style="margin-top:10px;margin-right:10px;"></div>');
}
function hideUploadMsg(){
    $("#upload_msg_box").remove();
}

document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
    WeixinJSBridge.call('hideToolbar');
});

$(document).ready(function(){
  $.get("{$ajaxClicksUrl}");
});
</script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js" type="text/javascript"></script>
<script>
wx.config({
    debug: false,
    appId: '{$wxJssdkConfig["appId"]}',
    timestamp: {$wxJssdkConfig["timestamp"]},
    nonceStr: '{$wxJssdkConfig["nonceStr"]}',
    signature: '{$wxJssdkConfig["signature"]}',
    jsApiList: [
      'onMenuShareTimeline',
      'onMenuShareAppMessage'
    ]
});
wx.ready(function () {
    wx.onMenuShareTimeline({
        title: '{$shareTitle}',
        link: '{$shareUrl}', 
        imgUrl: '{$shareLogo}', 
        success: function () { 
            $.get("{$shareAjaxUrl}");
        },
        cancel: function () { 
        }
    });
    wx.onMenuShareAppMessage({
        title: '{$shareTitle}',
        desc: '{$shareDesc}',
        link: '{$shareUrl}',
        imgUrl: '{$shareLogo}',
        type: 'link',
        dataUrl: '',
        success: function () { 
            $.get("{$shareAjaxUrl}");
        },
        cancel: function () { 
        }
    });
});
</script>
</body>
</html>